翻訳と辞書
Words near each other
・ Union Transfer and Storage Building
・ Union Transportation Trail
・ Union Trust and Savings Bank (Michigan)
・ Union Trust Bank
・ Union Trust Bank Company Building
・ Union Trust Building
・ Union Trust Building (Pittsburgh)
・ Union Trust Building (Seattle)
・ Union Trust Building (Washington, D.C.)
・ Union Trust Company Building (Providence, Rhode Island)
・ Union Trust Company Building (Springfield, Massachusetts)
・ Union Trust National Bank
・ Union Tunnel (Baltimore)
・ Union Turnpike
・ Union Turnpike (New York)
Union type
・ Union United Church
・ Union University
・ Union University (disambiguation)
・ Union University (New York)
・ Union University (Serbia)
・ Union Vale, New York
・ Union Valley
・ Union Valley Congregational Church
・ Union Valley Reservoir
・ Union Valley, Kaufman County, Texas
・ Union Valley, New Jersey
・ Union Valley, Texas
・ Union Village Shaker settlement
・ Union Village, Grenada


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Union type : ウィキペディア英語版
Union type

In computer science, a union is a value that may have any of several representations or formats; or it is a data structure that consists of a variable that may hold such a value. Some programming languages support special data types, called union types, to describe such values and variables. In other words, a union type definition will specify which of a number of permitted primitive types may be stored in its instances, e.g., "float or long integer". Contrast with a record (or structure), which could be defined to contain a float ''and'' an integer; in a union, there is only one value at any given time.
A union can be pictured as a chunk of memory that is used to store variables of different data types. Once a new value is assigned to a field, the existing data is overwritten with the new data. The memory area storing the value has no intrinsic type (other than just bytes or words of memory), but the value can be treated as one of several abstract data types, having the type of the value that was last written to the memory area.
In type theory, a union has a sum type; this corresponds to disjoint union in mathematics.
Depending on the language and type, a union value may be used in some operations, such as assignment and comparison for equality, without knowing its specific type. Other operations may require that knowledge, either by some external information, or by the use of a tagged union.
== Untagged unions ==
Because of the limitations of their use, untagged unions are generally only provided in untyped languages or in a type-unsafe way (as in C). They have the advantage over simple tagged unions of not requiring space to store a data type tag.
The name "union" stems from the type's formal definition. If a type is considered as the set of all values that that type can take on, a union type is simply the mathematical union of its constituting types, since it can take on any value any of its fields can. Also, because a mathematical union discards duplicates, if more than one field of the union can take on a single common value, it is impossible to tell from the value alone which field was last written.
However, one useful programming function of unions is to map smaller data elements to larger ones for easier manipulation. A data structure consisting, for example, of 4 bytes and a 32-bit integer, can form a union with an unsigned 64-bit integer, and thus be more readily accessed for purposes of comparison etc.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Union type」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.